home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_pow_drailgun_m.cog < prev    next >
Text File  |  1998-02-25  |  3KB  |  123 lines

  1. # Jedi Knight Missions Cog Script
  2. #
  3. # POW_DRAILGUN_M.COG
  4. #
  5. # POWERUP Script - Dropped Rail Gun
  6. #
  7. # [YB & CYW & CR] + [RF]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10.  
  11.  
  12. symbols
  13.  
  14. thing       powerup                          local
  15. thing       player                           local
  16. int         bin=7                            local
  17. int         ammobin=15                       local
  18. sound       pickupsnd=powerpu1.wav           local
  19. sound       respawnsnd=Activate01.wav        local
  20. flex        amount                           local
  21.  
  22. int         bin_contents=0                   local
  23. int         autopickup=0                     local
  24. int         autosel=-1                       local
  25.  
  26. message     touched
  27. message     taken
  28. message     respawn
  29.  
  30. end
  31.  
  32. # ========================================================================================
  33.  
  34. code
  35.  
  36. touched:
  37.    player = GetSourceRef();
  38.  
  39.    if (GetThingType(player) == 10)  // Can only be taken by players.
  40.    {
  41.       if(IsMulti() || (GetInv(player, bin) == 0) || (GetInv(player, ammobin) < GetInvMax(player, ammobin)))
  42.       {
  43.          TakeItem(GetSenderRef(), -1);
  44.          call taken;
  45.       }
  46.    }
  47.  
  48.    Return;
  49.  
  50. # ........................................................................................
  51.  
  52. taken:
  53.    player = GetSourceRef();
  54.    powerup = GetSenderRef();
  55.  
  56.    // Do effects.
  57.    PlaySoundLocal(pickupsnd, 1, 0, 0);
  58.    AddDynamicTint(player, 0.0, 0.0, 0.2);
  59.  
  60.    if(GetInv(player, bin) == 0)
  61.    {
  62.       // Pickup gun and ammo.
  63.       // Print("Rail Detonator");
  64.       jkPrintUNIString(player, bin);
  65.  
  66.       ChangeInv(player, GetWeaponBin(bin), 1.0);
  67.       ChangeInv(player, GetWeaponBin(bin+10), 1.0);
  68.       ChangeInv(player, ammobin, 3.0);
  69.  
  70.       // Check for Auto Pickup
  71.       autopickup = GetAutoPickup();
  72.       if((autopickup & 1) && !(autopickup & 2)) // DANGEROUS
  73.       {
  74.          if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, bin, 0))))
  75.          {
  76.             if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  77.             {
  78.                SelectWeapon(player, bin);
  79.                Return;
  80.             }
  81.          }
  82.       }
  83.    }
  84.    else
  85.    if(GetInv(player, ammobin) < GetInvMax(player, ammobin))
  86.    {
  87.       // Pickup ammo only.
  88.       // Print("Rail Charges");
  89.       jkPrintUNIString(player, ammobin);
  90.  
  91.       // store the old bin contents
  92.       bin_contents = GetInv(player, ammobin);
  93.  
  94.       ChangeInv(player, ammobin, 3.0);
  95.  
  96.       // Check for Auto Reload
  97.       if(GetAutoReload() & 1)
  98.       {
  99.          if(!bin_contents)
  100.          {
  101.             if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  102.             {
  103.                // Try to autoselect and see if the best weapon is the railgun
  104.                autosel = AutoSelectWeapon(player, 2);
  105.                if((autosel % 10) == bin) SelectWeapon(player, bin);
  106.             }
  107.          }
  108.       }
  109.    }
  110.  
  111.    Return;
  112.  
  113. # ........................................................................................
  114.  
  115. respawn:
  116.    PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
  117.  
  118.    Return;
  119.  
  120. end
  121.  
  122.  
  123.